XN.namespace("app");
XN.app.Comment=function(_1){
$extend(this,_1);
this.init();
};
XN.app.Comment.prototype={idForm:"commentPostForm",idSubmitBtn:"commentPostBtn",idTextArea:"cmtbody",idLeaveWord:"leaveWordTo",idWhisper:"whisper",idCmtContainer:"talk",showPicker:true,seeFriMode:false,isWhisper:false,msg:{empty:"\u7559\u8a00\u4e0d\u80fd\u4e3a\u7a7a",sureDelContact:"\u786e\u5b9a\u8981\u5220\u9664\u6b64\u8054\u7cfb\u4eba\u5417?",failDelContact:"\u51fa\u4e86\u70b9\u95ee\u9898, \u7a0d\u5019\u518d\u8bd5\u8bd5\u770b...",failNetError:"\u60a8\u7684\u7f51\u7edc\u51fa\u4e86\u70b9\u95ee\u9898, \u7a0d\u5019\u518d\u8bd5\u8bd5\u770b...",sendSus:"\u53d1\u9001\u6210\u529f"},url:{commentPost:"http://gossip."+XN.env.domain+"/gossip.do",add:"http://gossip."+XN.env.domain+"/gossip.do",del:"http://gossip."+XN.env.domain+"/delgossip.do",delContact:"/delcontact.do",black:"http://www."+XN.env.domain+"/Block.do"},catche:{},init:function(){
this.whisperCheck=$(this.idWhisper);
this.textarea=$(this.idTextArea);
if(!this.textarea){
return;
}
this.commentForm=$(this.idForm);
this.textarea.value="";
if(this.textarea._helper&&this.textarea._helper._defaultValue){
this.textarea.value=this.textarea._helper._defaultValue;
}
this.textareaHelper=new XN.form.textAreaHelper(this.textarea);
this.submit=$(this.idSubmitBtn);
this.cmtContainer=$(this.idCmtContainer);
this.dashOwner=this.dashOwner||this.commentForm.id.value;
this.initEditor();
this.bindEvent();
this.initAction();
var _2=this;
this.editor.addEvent("uploadSus",function(_3){
_2.textareaHelper.focus();
_2.hasPhoto=true;
});
this.editor.addEvent("uploadDel",function(_4){
_2.hasPhoto=false;
});
if(this.xinit){
this.xinit();
}
this.fireEvent("init_finished");
},bindEvent:function(){
var t=$(this.idSubmitBtn);
var _6=XN.event.addEvent;
var _7=this;
_6(t,"click",function(){
});
_6(this.idForm,"submit",function(e){
_7.checkForm(this.idForm);
XN.event.stop(e);
});
_6(this.idForm,"keydown",function(e){
e=e||window.event;
if(e.keyCode==13&&e.ctrlKey){
_7.checkForm(_7.idForm);
}
});
this.addEvent("afterPost",function(){
var t=$(_7.idLeaveWord);
if(t){
if(!_7.seeFriMode){
t.value=_7.dashOwner;
}
}
});
this.addEvent("gossip_send_success",function(){
_7.editor.colorReset();
});
if(!this.useCustomError&&!XN.app.Comment.useCustomError){
this.addEvent("internal_error",function(e){
XN.DO.showError("\u5185\u90e8\u9519\u8bef, \u8bf7\u7a0d\u5019\u518d\u8bd5...");
XN.log(e);
});
this.addEvent("post_error",function(o){
XN.DO.showMessage(o.msg);
});
this.addEvent("no_content_error",function(){
XN.DO.showError(this.msg.empty);
});
}
},checkForm:function(_d){
_d=_d||this.idForm;
var f=$(_d);
var ta=$(this.idTextArea);
var _10=/^(回复.*:)(.+)/;
var _11=/^(回复.*:)$/;
var _12=XN.form.help(ta).getRealValue();
if(!_12&&!this.hasPhoto){
this.fireEvent("no_content_error");
return false;
}
if(this.extendChecker){
if(this.extendChecker(this)===false){
return false;
}
}
_12=_12.replace(/[\n\r]/g," ");
if(this.curName){
var cn=this.curName.replace(/([\.\[\]\(\)\^\$])/g,"\\$1");
var _14="^(\u56de\u590d"+cn+")(:?)"+"(.*)";
var _15=new RegExp(_14);
var m=_15.exec(_12);
if(m){
if(!m[2]){
_12=m[1]+":"+m[3];
}
}else{
_12=("\u56de\u590d"+this.curName+":"+_12);
}
this.textarea.value=_12;
}
var _17=this;
this.sendAndAdd(function(){
if(!_17.seeFriMode){
_17.curName="";
}
if(_17.seeFriMode){
_17.textarea.value="\u56de\u590d"+_17.getCurName()+":";
}else{
_17.textarea.value="";
}
if(_17.noneDiv){
_17.noneDiv.hide();
}
_17.reset();
_17.enableSubmit();
_17.hideVerify();
_17.afterPost();
_17.fireEvent("afterPost");
});
_17.disableSubmit();
},initEditor:function(){
var _18=XN.user&&XN.user.colorfulGossip||window.colorfulGossip||false;
var _19=this.showPicker&&!this.isProfilePrivacy();
this.editor=new XN.ui.miniEditor({IDofForm:this.idForm,IDofTextarea:this.idTextArea,allowAddLink:false,allowAddPhoto:true,emoType:7,enablePicker:_18,showPicker:_19,pickerDisableClass:_18?"":"m-editor-graycolor",emoAlignType:"4-1",isVip:window.jf_vip_em||window.vipUser||this.isVip=="true"});
},isProfile:function(){
var _1a=RegExp("^http://gossip."+XN.env.domain);
if(_1a.test(document.location.href+"")){
return;
}
var _1b=false;
try{
if($("proTabFeedId_")&&$("proTabInfoId_")){
_1b=true;
}
}
catch(e){
}
return _1b;
},isProfilePrivacy:function(){
return $("xn_profile_privacy")!==null;
},initAction:function(){
this.commentsC=$(this.idCmtContainer);
var _1c=XN.DOM.getElementsByClassName("arrow",this.commentsC);
var bar,m;
for(var i=0;i<_1c.length;i++){
bar=_1c[i];
m=(bar.nextSibling.nodeType==3)?bar.nextSibling.nextSibling:bar.nextSibling;
XN.debug.log("menu...");
new XN.UI.menu({bar:bar,fireOn:"mouseover",offsetY:-1,alignType:"3-2",menu:m,keep:0.1});
}
},resetServerParams:function(){
this.curpage=0;
this.destpage=-1;
this.guestBeginId="";
this.guestEndId="";
this.hostBeginId="";
this.hostEndId="";
},saveServerParams:function(o){
if(!this.gossipCountC){
this.gossipCountC={};
}
this.gossipCountC[o.guest]=o.gossipCount||0;
this.guestBeginId=o.guestBeginId;
this.guestEndId=o.guestEndId;
this.hostBeginId=o.hostBeginId;
this.hostEndId=o.hostEndId;
XN.debug.log("saved : "+this.hostBeginId+" "+" "+this.hostEndId+" "+this.guestBeginId+" "+this.guestEndId);
},sendAndAdd:function(fn){
var _22;
_22=this.whisper?"&only_to_me=1":"&only_to_me=0";
var _23=this;
var _24=XN.form.serialize(this.idForm);
if(_24.indexOf("only_to_me")==-1){
_24+=_22;
}
var _25=this.editor.getColor&&this.editor.getColor();
_25=_25?_25.substring(1):"";
try{
new XN.net.xmlhttp({url:this.url.commentPost,data:_24+"&color="+_25+"&ref="+("http://"+location.host+location.pathname)+"&mode="+(_23.seeFriMode?"conversation":""),onSuccess:function(r){
_23.enableSubmit();
try{
var res=r.responseText;
var o=eval("("+res+")");
if(o.code){
if(o.code==4){
_23.addVerify();
_23.changeVerifyCode();
if($("verifyCodeInput")){
$("verifyCodeInput").value="";
}
_23.fireEvent("needVerify");
}else{
if(o.code==6){
return;
}
}
_23.fireEvent("post_error",o);
return;
}else{
if(o.hasReadRight){
_23.addComment({isCurrentUser:o.guest==o.visiter,guestId:o.visiter,CurrentUserName:o.array[0].guestName,comment:o.array[0],visiter:o.visiter});
}else{
var al=XN.DO.alert("<p style=\"padding:10px;text-align:center;\">"+_23.msg.sendSus+"</p>");
al.footer.hide();
al.autoHide(1);
}
_23.fireEvent("gossip_send_success");
}
if(fn){
fn.call(_23);
}
}
catch(e){
_23.fireEvent("internal_error");
if(XN.DEBUG_MODE){
XN.debug.log(e);
}
}
},onComplete:function(){
try{
_23.changeVery();
}
catch(e){
}
}});
}
catch(e){
}
},changeVery:function(){
this.changeVerifyCode();
$("verifyCodeInput").value="";
},addComment:function(obj){
var c=$element("div");
c.innerHTML=this.buildComment(obj);
if(!$(this.idCmtContainer)){
return;
}
$(this.idCmtContainer).insertBefore(c.getElementsByTagName("div")[0],this.cmtContainer.firstChild);
},atFilter:function(str){
var _2d=/@([^\(\)@]+)\((\d+)\) /ig;
return str.replace(_2d,"<a target=\"_blank\" href=\"http://www.renren.com/profile.do?id=$2\">@$1 </a>");
},buildComment:function(_2e){
var _2f=this;
var cms=[];
var _31=[];
var _32=(_2e.comment.owner==_2e.visiter);
XN.debug.log("visiterIsCommentOwner : "+_32+"  owner=="+_2e.comment.owner+"    "+"  visiter=="+_2e.visiter);
var _33=_2e.isAdmin=="true"||_32;
XN.debug.log("\n");
var _34=["<div class=\"attachment\" >","<img src=\"",_2e.comment.headUrl,"\" onclick=\"showLargePhoto(this, '",_2e.comment.largeUrl,"');\" style=\"opacity:1\"/>","</div>"];
_31.push("<div class=\"png-holder\">","<div class=\"png-img\" ><a href=\"http://gift.",XN.env.domain,"/view.do?id=",_2e.comment.owner,"\"><img src=",_2e.comment.giftImg," /></a></div>","</div>");
var _35=(_2e.visiter!=_2e.comment.guestId);
var _36=(_35)?"<a class=\"reply\" href=\"#\" onclick=\"replyComment('"+_2e.comment.guestName+"','"+_2e.comment.guestId+"','"+_2e.comment.id+"',"+_2e.comment.whisper+");return false;\">\u56de\u590d</a>":"";
var del=(_2e.visiter==_2e.comment.owner||_2e.visiter==_2e.comment.guestId||(_2e.isAdmin&&_2e.comment.owner!=0))?"<a class=\"del\" href=\"#nogo\" onclick=\"delComment('"+_2e.comment.id+"','"+_2e.comment.owner+"','recent',"+_2e.comment.guestId+");return false;\">\u5220\u9664 </a>":"";
var _38="";
var _39="";
if(del){
_39="";
_38=del;
}
if(_36){
_38=_36;
}
if(_2e.visiter!=_2e.comment.guestId){
_39+="<li><a href=\"http://msg."+XN.env.domain+"/SendMessage.do?id="+_2e.comment.guestId+"\">\u53d1\u7ad9\u5185\u4fe1</a></li>";
_39+="<li><a href=\"http://support."+XN.env.domain+"/report/common?type=4&amp;owner="+_2e.comment.owner+"&amp;contentId="+_2e.comment.id+"&amp;userId="+_2e.comment.guestId+"&amp;origURL=http://xiaonei.com/profile.do?id="+_2e.guestId+"\">\u4e3e\u62a5</a></li>";
if(_2e.isAdmin||del){
_39="<li><a onclick=\"delComment('"+_2e.comment.id+"','"+_2e.comment.owner+"','recent',"+_2e.comment.guestId+");return false;\" href=\"#nogo\">\u5220\u9664 </a></li>"+_39;
}
}
var _3a=["<div class=\"super-actions\">","<a class=\"arrow\" href=\"#nogo\">\xa0</a>","<div class=\"super-menu\">","<ul class=\"menu-item\">",_39,"</ul>","</div>","</div>"];
cms.push("<div id=\"","comment_",_2e.comment.id,"\" class=\"comment ",_2e.comment.gift=="true"?"with-gift":"","\" >","<div class=\"actor-img\">","<a href=\"http://www.",XN.env.domain,"/profile.do?portal=leaveword&id=",_2e.comment.guestId,"\" style=\"background-image: url(",_2e.comment.tinyUrl,");\"></a>","</div>","<div class=\"cmt-body\">",_2e.comment.gift=="true"?_31.join(""):"","<div class=\"info\">","<span class=\"author\">","<a title=\"",_2e.comment.keepUse=="true"?"\u8fde\u7eed\u767b\u5f557\u5929\uff0c\u5373\u53ef\u83b7\u5f97\u6a59\u540d\u7279\u6743":"\u70b9\u51fb\u67e5\u770b\u4e2a\u4eba\u4e3b\u9875","\" ",_2e.comment.keepUse=="true"?"class=\"lively-user\"":""," href=\"http://www.",XN.env.domain,"/profile.do?portal=leaveword&id=",_2e.comment.guestId,"\">",_2e.comment.guestName,"</a>","</span>","<span class=\"time\">",_2e.comment.time,"</span>","<div class=\"actions\">",_38,_39?_3a.join(""):"","</div>","</div>","<div class=\"text-content\">",_2e.comment.whisper=="true"||_2e.comment.chatId>0?"<span class=\"whisper\">\u6084\u6084\u8bdd</span>":"",this.atFilter(_2e.comment.body),_2e.comment.wap=="true"?"<a href=\"http://mobile.renren.com\"><img class=\"mb-cmt\" src=\"http://a.xnimg.cn/imgpro/icons/mobile.gif\" alt=\"\u901a\u8fc7\u624b\u673a\u53d1\u5e03\" title=\"\u901a\u8fc7\u624b\u673a\u53d1\u5e03\"></a>":"",_2e.comment.headUrl?_34.join(""):"","</div>","</div>","</div>");
return cms.join("");
},fetchComment:function(o,fn){
if(this.isLoading){
return;
}
this.fireEvent("before_fetch_comment");
this.showLoading();
XN.debug.log("fetchComment : "+o.hostBeginId+"  "+o.hostEndId+"  "+o.guestBeginId+" "+o.guestEndId);
XN.debug.log("fetchComment( params in object) : "+this.hostBeginId+"  "+this.hostEndId+"  "+this.guestBeginId+" "+this.guestEndId);
var _3d=this;
var _3e=o.userId;
var _3f=o.pageNum;
var url=o.url;
var fn=fn||o.callBack||undefined;
XN.debug.log("fetchComment( curpage in object) : "+_3d.curpage);
var p={guest:_3e,curpage:_3d.curpage==undefined?-1:_3d.curpage,destpage:o.destpage||0,hostBeginId:o.hostBeginId||"",hostEndId:o.hostEndId||"",guestBeginId:o.guestBeginId||"",guestEndId:o.guestEndId||"",page:_3f,id:_3e,resource:o.resource,search:o.search||"0",boundary:o.boundary||0};
XN.debug.log("fetchComment( query string ) : "+XN.array.toQueryString(p));
var ret;
function handle(obj){
var cms=[];
XN.debug.log("get "+obj.array.length+" comments...");
XN.array.each(obj.array,function(i,_46){
var _47=_3e==_46.id;
var _48=_3d.buildComment({isCurrentUser:_47,isDashOwner:_46.id==_3d.dashOwner,comment:_46,guestId:_3e,commentOwner:_46.guestId,CurrentUserName:obj.name,isAdmin:obj.admin,visiter:obj.visiter,buildOwn:o.buildOwn});
cms.push(_48);
});
_3d.renderPanel(cms.join(""));
}
var _49=_3e+"_"+_3f;
if(this.catche[_49]){
this.loading.hide();
var oo=this.catche[_49];
handle(oo);
if(fn){
fn.call(_3d,oo);
}
return;
}
new XN.net.xmlhttp({url:url||"http://gossip."+XN.env.domain+"/getconversation.do",data:XN.array.toQueryString(p)+"&gossipCount="+_3d.getGossipCount(url,p.guest),onSuccess:function(r){
_3d.fireEvent("comments_got");
_3d.hideLoading();
var res=r.responseText;
if(res){
XN.debug.log("fetch suscess...");
var obj=eval("("+res+")");
if((!obj.array||!obj.array.length)&&(p.page==0||p.page==undefined)){
_3d.fireEvent("noComments");
return;
}else{
if((!obj.array||!obj.array.length)&&(p.page>0)){
_3d.fireEvent("noCommentErr");
return;
}
}
handle(obj);
}else{
XN.debug.log("---------------------------------------------------->>>>empty content server return");
_3d.fireEvent("noCommentErr");
return;
}
if(fn){
obj.guest=p.guest;
fn.call(_3d,obj);
}
},onError:function(){
_3d.loading.hide();
}});
},hideLoading:function(){
this.loading&&this.loading.hide();
this.isLoading=false;
},getGossipCount:function(url,_4f){
if(url=="ajaxgossiplist.do"){
return this.gossipCount;
}else{
return this.gossipCountC&&this.gossipCountC[_4f]||0;
}
},fetchOwerComment:function(_50){
this.fetchComment({userId:this.dashOwner,pageNum:_50,url:"ajaxgossiplist.do"});
},showLoading:function(){
this.buildLoading();
this.loading&&this.loading.show();
scrollTo(0,0);
this.isLoading=true;
},showNone:function(msg){
var t=$(this.idCmtContainer);
if(!t){
return;
}
if(!this.noneDiv){
this.makeNoneDiv(msg);
}
msg=msg||"\u4f60\u4eec\u4e4b\u95f4\u8fd8\u672a\u6709\u8fc7\u7559\u8a00\u5bf9\u8bdd\u5662\u3002\u6709\u60c5\u6709\u4e49\u7684\u4f60\uff0c\u60f3\u5230\u6709\u8fd9\u4e2a\u597d\u53cb\uff0c\u5c31\u8bf4\u70b9\u4ec0\u4e48\u5427\u3002";
t.innerHTML="<p style=\"text-align:center;background:#fff9d7;border:solid 1px #d7b013;padding:5px 0;margin:10px 0;\">"+msg+"</p>";
this.pager&&this.pager.setPageCount(0);
this.textareaHelper.focus();
this.noneDiv&&this.noneDiv.show();
this.hideNotice();
},hideNotice:function(){
if(this.noticeSpan){
this.noticeSpan.hide();
}
},buildLoading:function(){
if(!this.loading){
this.loading=$element("div");
}
this.loading.innerHTML="<span style=\"background:url(http://s.xnimg.cn/img/indicator.gif) no-repeat 2px 2px;display:block; padding-left:8px; height:18px\" >&nbsp;&nbsp;&nbsp;&nbsp;\u6b63\u5728\u8f7d\u5165...</span>";
var _53=$(this.idLoadingWrap);
_53&&_53.appendChild(this.loading);
},renderPanel:function(_54){
if(_54){
this.cmtContainer.innerHTML=_54;
this.initAction();
}else{
this.fireEvent("noComments");
}
},reply:function(_55,uid,cid,_58){
_58=_58||false;
this.curName=_55;
var ta=$(this.idTextArea);
ta.value="\u56de\u590d"+_55+": ";
$(this.idLeaveWord).value=uid;
window.loaction="#"+ta.id;
try{
if(_58){
this.whisperCheck.checked=true;
this.whisperCheck.disabled=true;
this.whisper=true;
}else{
this.whisperCheck.disabled=false;
this.whisperCheck.checked=false;
this.whisper=false;
}
}
catch(e){
}
this.textareaHelper.focus();
this.hideVerify();
},del:function(cid,uid,age,_5d){
var el=$(cid);
var _5f=this;
var msg="<p style=\"padding:3px;\">\u60a8\u786e\u5b9a\u8981\u5220\u9664\u8fd9\u6761\u7559\u8a00\u5417?</p>";
var p={id:cid,owner:uid,age:age};
if(typeof _5d=="number"&&_5d!=parseInt(uid)){
msg="<div style=\"font-size:12px;margin-bottom:10px\">\u4f60\u786e\u5b9a\u8981\u5220\u9664\u8fd9\u6761\u7559\u8a00\u5417\uff1f </div>";
if(!(XN.user&&XN.user.isAdmin)){
msg+="<div class=\"description\" style=\"text-align:right;\"><label style=\"font-weight:normal;\"><input id=\"xn_comment_black\" class=\"input-checkbox\" type=\"checkbox\" />\u540c\u65f6\u62c9\u5165\u9ed1\u540d\u5355</label></div>";
}
}
XN.DO.confirm(msg,"\u5220\u9664\u7559\u8a00",function(r){
if(r){
if($("xn_comment_black")&&$("xn_comment_black").checked){
new XN.NET.xmlhttp({url:"http://www."+XN.env.domain+"/Block.do",method:"get",data:"id="+_5d,onSuccess:function(r){
},onError:function(){
}});
}
new XN.NET.xmlhttp({url:_5f.url.del,data:XN.array.toQueryString(p),onSuccess:function(r){
_5f.ondel(cid);
},onError:function(){
}});
}
});
},enableSubmit:function(){
this.submit.disabled=false;
this.submit.value="\u7559\u8a00";
this.submit.delClass("gray");
this.whisperCheck.disabled=false;
},disableSubmit:function(){
this.submit.blur();
this.submit.disabled=true;
this.whisperCheck.disabled=true;
this.submit.value="\u8bf7\u7a0d\u5019";
this.submit.addClass("gray");
},ondel:function(id){
XN.Element.hide($("comment_"+id),"fade");
},showLargePhoto:function(ele,url){
ele=$(ele);
ele.style.opacity="0.8";
var _68=document.createElement("div");
_68.innerHTML="<img src=\"http://s.xnimg.cn/img/indicator.gif\" />";
_68.style.position="absolute";
_68.style.left=(ele.width/2-8)+"px";
_68.style.top=(ele.height/2-8)+"px";
ele.parentNode.appendChild(_68);
var img=new Image();
img.style.cursor="url(http://a.xnimg.cn/imgpro/cursor/zoom-out.cur), pointer";
img.onload=function(){
ele.style.opacity="1";
_68.parentNode.removeChild(_68);
var _6a=img.height+50;
var y=ele.realTop()-_6a/2;
if((ele.realTop()+ele.height)>(XN.event.scrollTop()+XN.event.winHeight()-30)){
y=XN.event.scrollTop()+XN.event.winHeight()-_6a-40;
}
if(ele.realTop()<XN.event.scrollTop()){
y=XN.event.scrollTop()+20;
}
if((y+_6a)>(XN.event.scrollTop()+XN.event.winHeight())){
y=ele.realTop()-_6a+ele.height+25;
}
if(y<XN.event.scrollTop()){
y=XN.event.scrollTop()+25;
}
if($("tabBody")){
var x=ele.realLeft()-$($("tabBody").parentNode).realLeft()-20;
}
var a=XN.DO.alert({msg:this,width:img.width+20,X:x,Y:y});
this.parentNode.style.padding="0";
var p=this.parentNode;
p.style.border="0";
var ppp=this.parentNode.parentNode.parentNode;
var h=ppp.getElementsByTagName("h2")[0];
h.style.border="0";
a.header.hide();
a.body.parentNode.style.borderWidth="0";
a.footer.hide();
img.onclick=function(){
a.hide();
};
this.onload=null;
};
img.src=url;
},afterPost:function(){
},hideTooltip:function(){
try{
$("gossipPhotoTooltip").innerHTML="";
$("gossipPhotoTooltip").id="";
XN.cookie.set("noPhotoTooltip",1,360);
}
catch(e){
}
},reset:function(){
this.enableSubmit();
try{
this.whisperCheck.checked=false;
this.whisper=false;
}
catch(e){
}
},changeVerifyCode:function(){
this.getVerifyCode().src="http://icode."+XN.ENV.domain+"/getcode.do?t=gossip&rnd="+parseInt(Math.random()*1000000);
},getVerifyCode:function(){
return this.verifyCode||$("verifyPic");
},getVerifyInput:function(){
return this.verifyInput||$(this.verifyInput);
},bindVerifyEvent:function(){
var _71=$("cmtbody");
if(!_71.bind){
var _72=this;
_71.bind=true;
}
},hideVerify:function(){
if($("messageCaptcha")){
$("messageCaptcha").hide();
}
},addVerify:function(){
this.bindVerifyEvent();
if(!$("messageCaptcha")){
this.verify=["<div id=\"messageCaptcha\">","<p style=\"margin: 5px 0;clear:both;padding:5px 0 0\">","<label>\u8bf7\u8f93\u5165\u9a8c\u8bc1\u7801: <input type=\"text\" id=\"verifyCodeInput\" autoComplete=\"false\"  name=\"verifyCode\"/></label>","</p>","<p style=\"margin: 5px 0\">","<img style=\"width: 145px; height: 60px; vertical-align: middle; margin:0 5px 0 47px ;\" src=\"http://icode.renren.com/getcode.do?t=gossip&rk=600&amp;temp="+Math.random()+"\" id=\"verifyPic\"/>","<a \thref=\"javascript:;\"  onclick=\"$('verifyPic').src='http://icode.renren.com/getcode.do?t=gossip&amp;rk=600&amp;temp='+Math.random();return false;\">\u770b\u4e0d\u6e05\u6216\u770b\u4e0d\u89c1\uff1f\u6362\u4e00\u5f20</a>","</p>","</div>"].join("");
$($("miniEditorAction").parentNode).appendHTML(this.verify);
}else{
$("messageCaptcha").show();
}
},hideVerify:function(){
var t=$("messageCaptcha");
if(t){
t.hide();
}
}};
XN.EVENT.enableCustomEvent(XN.app.Comment.prototype);
XN.DOM.ready(function(){
});
XN.app.Comment.init=function(){
window.commentPost=new XN.app.Comment({});
window.replyComment=function(_74,uid,cid,_77){
commentPost.reply(_74,uid,cid,_77);
};
window.delComment=function(cid,uid,age,_7b){
commentPost.del(cid,uid,age,_7b);
};
window.showLargePhoto=function(ele,url){
commentPost.showLargePhoto(ele,url);
};
window.delContact=function(_7e){
commentPost.delContact(_7e);
};
window.hideTooltip=function(){
commentPost.hideTooltip();
};
};
XN.app.Comment.miniGossip=function(_7f){
$extend(this,_7f);
this.init(_7f);
};
XN.app.Comment.miniGossip.prototype={init:function(_80){
_80=_80||{};
_80.useCustomError=true;
var _81=this;
this.addEvent("skeletonBuild",function(){
XN.ui.miniEditor.prototype._emoKind={"0":{name:"\u9ed8\u8ba4\u8868\u60c5"}};
_81.commentPost=new XN.app.Comment(_80);
_81.commentPost.extendChecker=function(){
if(!this.textareaHelper.getRealValue()){
this.fireEvent("no_content_error");
return false;
}
};
_81.getUIRef();
_81.bindEvent();
});
},getUIRef:function(){
this.dataLeaveTo=$("leaveWordTo");
this.dataDashOwn=$("gossipDashOwner");
},bindEvent:function(){
var _82=this;
if(this.customBind===true){
return;
}
this.commentPost.addEvent("internal_error",function(){
if(!_82.useCustomNotify){
_82.setDefault("\u5185\u90e8\u9519\u8bef,\u8bf7\u7a0d\u540e\u518d\u8bd5...");
}
_82.fireEvent("internal_error");
});
this.commentPost.addEvent("post_error",function(o){
if(!_82.useCustomNotify){
_82.setDefault(o.msg);
}
_82.fireEvent("post_error",o);
});
this.commentPost.addEvent("afterPost",function(){
if(!_82.useCustomNotify){
_82.setDefault("\u53d1\u9001\u6210\u529f!");
setTimeout(function(){
_82.popup.hide();
},1000);
}
_82.fireEvent("afterPost");
});
this.commentPost.addEvent("no_content_error",function(){
if(!_82.useCustomNotify){
_82.setDefault("\u62b1\u6b49, \u7559\u8a00\u5185\u5bb9\u4e0d\u80fd\u4e3a\u7a7a:...");
}
_82.fireEvent("no_content_error");
});
},setDefault:function(msg){
this.commentPost.textareaHelper._default=false;
this.commentPost.textareaHelper.setDefaultValue(msg);
},makeTitle:function(_85){
var _85=_85||this.toName;
return "\u53d1\u7ed9"+_85+"\u4eba\u4eba\u7684\u7b2c\u4e00\u53e5\u95ee\u5019";
},buildPopup:function(fn){
var _87=this;
function appendToBody(txt){
var div=$element("div");
div.id="mini_gossip";
div.className="guide-message";
div.style.display="none";
div.innerHTML=txt;
document.body.appendChild(div);
}
new XN.net.xmlhttp({useCache:true,url:"http://gossip."+XN.env.domain+"/pages/gossip/inc/cmtbox.inc",onSuccess:function(r){
appendToBody(r.responseText);
XN.loadFiles(["http://s.xnimg.cn/csspro/module/minieditor.css","http://s.xnimg.cn/jspro/xn.ui.minieditor.js"],function(){
try{
_87.popup=XN.DO.alert({message:$("mini_gossip"),width:"478",title:"\u53d1\u7ed9"+_87.toName+"\u4eba\u4eba\u7684\u7b2c\u4e00\u53e5\u95ee\u5019",params:{showCloseButton:true}});
$("title_head").innerHTML="\u7559\u8a00\u677f";
$("mini_gossip").show();
$("leaveWordTo").value=_87.toId;
$("gossipDashOwner").value=_87.toId;
_87.popup.footer.hide();
_87.popup.body.style.padding="0px";
_87.fireEvent("skeletonBuild");
}
catch(e){
if(XN.DEBUG_MODE){
alert(e);
}
}
if(fn){
fn();
}
});
}});
},show:function(){
var _8b=this;
if(!this.popup){
this.buildPopup(function(){
_8b.subShow();
});
return;
}
this.subShow();
},subShow:function(){
this.commentPost.textarea.value="";
this.commentPost.textareaHelper._default=false;
this.commentPost.textareaHelper.setDefaultValue(this.TIPDefault||"\u7ed9TA\u7559\u8a00");
try{
this.popup.header.innerHTML=this.makeTitle();
this.dataLeaveTo.value=this.toId;
this.dataDashOwn.value=this.toId;
}
catch(e){
alert(e);
}
this.popup.show();
},leaveTo:function(_8c,id){
this.toId=id;
this.toName=_8c;
this.show();
}};
XN.event.enableCustomEvent(XN.app.Comment.miniGossip.prototype);
XN.dom.ready(function(){
var _8e=RegExp("^http://gossip."+XN.env.domain);
if(_8e.test(document.location.href+"")){
return;
}
var _8f=false;
try{
if($("proTabFeedId_")&&$("proTabInfoId_")){
_8f=true;
}
}
catch(e){
}
var _90=document.location.href+"";
if(!(_8e.test(_90)||_8f)){
XN.app.Comment.useCustomError=true;
if(XN.ui.miniEditor){
XN.ui.miniEditor.prototype._emoKind={"0":{name:"\u9ed8\u8ba4\u8868\u60c5"}};
}
}else{
XN.app.Comment.init();
}
});
XN.dom.ready(function(){
if(window.leave_message_to){
}else{
XN.app.Comment.minigossip=new XN.app.Comment.miniGossip({showPicker:false});
window.leave_message_to=function(_91,id){
XN.app.Comment.minigossip.leaveTo(_91,id);
};
}
});
XN.dom.ready(function(){
if(!$("cmtbody")||!Sizzle("#commentPostForm input[name=\"id\"]")[0]){
return;
}
object.use("xn.mention",function(_93,xn){
xn.mention.Mention.init([{obj:$("cmtbody"),ugcType:"gossip",ownerId:Sizzle("#commentPostForm input[name=\"id\"]")[0].value}]);
});
},true);

